package algo.graph;

import java.util.Scanner;

public class Digraph extends Graph{

	public Digraph(int V) {
		super(V);
	}
	
	public Digraph(Scanner s) {
		super(s);
	}
	

	public void addEdge(int v, int w) {
		adj[v].add(w);
		edgeCount++;
	}

	public Iterable<Integer> adj(int v) {
		return adj[v];
	}

	public Digraph reverse() {
		Digraph R = new Digraph(vertexCount);
		for (int v = 0; v < vertexCount; v++)
			for (int w : adj(v))
				R.addEdge(w, v);
		return R;
	}

	@Override
	public void deleteEdge(int s, int v) {
		adj[s].remove(v);
		edgeCount--;		
	}
}